
# 查询面包屑导航
def get_breadcrumb(category):
    breadcrumb = {
        'cat1':'',
        'cat2': '',
        'cat3': ''
    }
    if category.parent is None:
        breadcrumb['cat1']=category
    elif category.subs.count()==0:
        breadcrumb['cat1'] = category.parent.parent
        breadcrumb['cat2'] = category.parent
        breadcrumb['cat3'] = category
    else:
        breadcrumb['cat1'] = category.parent
        breadcrumb['cat2'] = category
    return breadcrumb














    # breadcrumb={
    #     'cat1':'',
    #     'cat2':'',
    #     'cat3':''
    # }
    # if category.parent is None:
    #     breadcrumb['cat1']=category
    # elif category.subs.count() == 0:
    #     breadcrumb['cat1'] = category.parent.parent
    #     breadcrumb['cat2'] = category.parent
    #     breadcrumb['cat3'] = category
    # else:
    #     breadcrumb['cat1'] = category.parent
    #     breadcrumb['cat2'] = category
    # return breadcrumb
